package com.cloud.api.log.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;


@Data
@Document(collection = "cloud-api-log")  //指定要对应的文档名(表名）
public class CloudApiLogEntity implements Serializable {

    /*** 自定义mongo主键 加此注解可自定义主键类型以及自定义自增规则
     *  若不加 插入数据数会默认生成 ObjectId 类型的_id 字段
     *  org.springframework.data.annotation.Id 包下
     *  mongo库主键字段还是为_id (本文实体类中字段为为id，意思查询字段为_id，但查询结果_id会映射到实体对象id字段中）
     */
    @Id
    private String id;

    @JsonFormat(locale = "zh", timezone = "Asia/Shanghai", pattern = "yyyy-MM-dd HH:mm:ss")
    @Field("createTime")
    private Date createTime;
    private String userName;
    private String springApplicationName;
    private String operationModular;
    private String operationMethod;
    private String operationDes;
    private String requestURL;
    private String requestIp;
    private String requestMethod;
    private String requestSignature;
    private String requestArgs;
    private String result;

    private String requestTime;
}

